﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using com.tiyma.components;
using System.Drawing;
using com.tiyma.common;

namespace com.tiyma.web
{
    public partial class v : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Buffer = true;
            Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            VerfyCodeManager v = new VerfyCodeManager();

            try
            {
                string code = v.CreateVerifyCode();                //取随机码
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                Bitmap image = v.CreateImageCode(code);

                image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                Response.ClearContent();
                Response.ContentType = "image/Jpeg";
                Response.BinaryWrite(ms.GetBuffer());

                ms.Close();
                ms = null;
                image.Dispose();
                image = null;


            }
            catch (Exception ex)
            {
                LogHelper.Error(ex.ToString());
            }
        }
     }

}
